#/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2022/1/17 14:57
# @Author  : wf
# @Email   : wf@163.com
# @File    : page_collection.py
# @Software: PyCharm
"""收藏功能页面"""
from selenium.webdriver.common.by import By
from time import  sleep
from pages.page_base import PageBase
class PageGiveTheThumbsUp(PageBase):
    """每日菜单主页面"""
    #进入每日菜单主页面定位
    loca_everyday_menu=By.ID,"com.gfeng.daydaycook:id/tv_more"
    #选择商品定位
    loca_goods=By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id="com.gfeng.daydaycook:id/recyclerView"]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.ImageView[1]'

    #打开软件
    def click_menu(self):  #点击进入主页
        self.driver.tap([(525,361)])

    def click_goods(self): #点击商品
        self.driver.tap([(85,370)])

    def click_like(self):   #收藏
        self.driver.tap([(634, 1500)])

    def collection(self):  #收藏功能
        self.click_menu()
        sleep(3)
        self.click_goods()
        sleep(4)
        self.click_like()
        sleep(4)
#添加断言
    def dz_duanyan(self):
        dy_locator=(By.XPATH,'com.gfeng.daydaycook:id/like_textview')
        return self.driver.find_element(*dy_locator).text